{% extends 'base.html' %}

{% block title %}{{ data.table_name }}搜索结果{% endblock %}

{% block content %}
<div class="card mt-3">
    <div class="card-header">搜索</div>
    <div class="card-body">
        <form method="GET" action="{{ url_for('app.search_tables') }}" class="row g-3">
            <div class="col-md-10">
                <input type="text" class="form-control" id="searchTableName" name="table_name" placeholder="输入表名">
            </div>

            <div class="col-md-2 d-flex align-items-end">
                <button type="submit" class="btn btn-primary w-100">搜索</button>
            </div>
        </form>
    </div>
</div>

<div class="card mt-3">
    <div class="card-header">【{{ data.table_name }}】搜索结果</div>
    <div class="card-body">
        <table class="table table-bordered mt-3">
            <thead>
            <tr>
                <th>fid</th>
                <th>表名</th>
                <th>表实体</th>
                <th>列数</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for table in data.tables %}
            <tr>
                <th>{{ table.fid }}</th>
                <td>{{ table.name }}</td>
                <td>{{ table.owner }}</td>
                <td>{{ table.column_count }}</td>
                <td>
                    <a href="/table/{{table.table_id}}/r/{{table.pdm_id}}/" target="_blank" class="btn btn-info btn-sm">查看</a>
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endblock %}
